package com.longchat.service.impl.system;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.longchat.domain.Configuration;
import com.longchat.repository.ConfigurationJpaRepository;
import com.longchat.service.inter.system.IConfigurationService;

@Service
public class ConfigurationService implements IConfigurationService {
	
	@Autowired
	private ConfigurationJpaRepository configurationJpaRepository;

	@Override
	public Map<String, String> findAllConfiguration() {
		List<Configuration> configs = (List<Configuration>) configurationJpaRepository.findAll();
		Map<String,String> configsMap = new HashMap<String,String>();
		for(Configuration c:configs){
			configsMap.put(c.getCode(), c.getValue());
		}
		return configsMap;
	}

}
